home *** CD-ROM | disk | FTP | other *** search
/ TOS Silver 2000 / TOS Silver 2000.iso / programm / MM2_DEV / S / MYUTIL / SHOWDIR.M < prev    next >
Encoding:
Text File  |  1990-10-13  |  2.1 KB  |  59 lines

  1. (*$c-*)
  2. module ShowDir;
  3.  
  4. from inout import OpenOutput, writeln, WriteString, readstring, write, read,
  5.         CloseOutput, writeint;
  6. from directory import dirquery, direntry, fileattr, fileattrset;
  7. import strings;
  8.  
  9. var ch:char;
  10.     res:INTEGER;
  11.     level:CARDINAL;
  12.     b: BOOLEAN;
  13.  
  14.  
  15. PROCEDURE showentry (path:ARRAY OF CHAR; e:direntry):BOOLEAN;
  16.   var res:integer; i:CARDINAL; p:ARRAY [0..142] of char; b:BOOLEAN; c:char;
  17.   begin
  18.     with e do
  19.       IF subdirAttr IN attr THEN
  20.         if name[0]#'.' then
  21.           for i:=1 to level do WriteString ('  ') end;
  22.           WriteString ('sub: ');
  23.           WriteString (path);
  24.           writestring (name); writeln;
  25.           inc (level);
  26.           strings.concat (name,'\',p,b);
  27.           strings.concat (path,p,p,b);
  28.           strings.concat (p,'*.*',p,b);
  29.           dirquery (p,FileAttrSet{subdirAttr},showentry,res);
  30.           if res<0 then writeint (res,0); writeln; read (c) end;
  31.           dec (level)
  32.         end
  33.       else
  34.         for i:=1 to level do WriteString ('  ') end;
  35.         writestring (name); writeln;
  36.       end
  37.     end;
  38.     return true
  39.   end showentry;
  40.  
  41. VAR p: ARRAY [0..127] of char;
  42.  
  43. begin
  44.   level:=0;
  45.   WriteString ('Root dir ? ');
  46.   ReadString (p);
  47.   OpenOutput ('TXT');
  48.   strings.append ('*.*',p,b);
  49.   dirquery (p,FileAttrSet{subdirAttr},showentry,res);
  50.   CloseOutput;
  51.   if res<0 then
  52.     writeint (res,0);
  53.   else
  54.     writestring ('OK.')
  55.   end;
  56. end ShowDir.
  57. ə
  58. (* $FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFF6A486$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DE$FFFB32DEÇ$00000597T.......T.......T.......T.......T.......T.......T.......T.......T.......T.......$FFF6A486$FFF6A486$00000118$000004BF$00000509$000002B7$00000453$000005BE$00000597$000005BB$FFF9CF2A$000005B2$00000597$0000056B$0000055F$0000007FœÇÇ*)
  59.